import 'package:distribution_mall_flutter/generated/json/base/json_convert_content.dart';
import 'package:distribution_mall_flutter/entity/delete_account/delete_account_check_entity.dart';

DeleteAccountCheckEntity $DeleteAccountCheckEntityFromJson(
    Map<String, dynamic> json) {
  final DeleteAccountCheckEntity deleteAccountCheckEntity = DeleteAccountCheckEntity();
  final DeleteAccountCheckBody? body = jsonConvert.convert<
      DeleteAccountCheckBody>(json['body']);
  if (body != null) {
    deleteAccountCheckEntity.body = body;
  }
  final DeleteAccountCheckStatus? status = jsonConvert.convert<
      DeleteAccountCheckStatus>(json['status']);
  if (status != null) {
    deleteAccountCheckEntity.status = status;
  }
  return deleteAccountCheckEntity;
}

Map<String, dynamic> $DeleteAccountCheckEntityToJson(
    DeleteAccountCheckEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['body'] = entity.body?.toJson();
  data['status'] = entity.status?.toJson();
  return data;
}

extension DeleteAccountCheckEntityExtension on DeleteAccountCheckEntity {
  DeleteAccountCheckEntity copyWith({
    DeleteAccountCheckBody? body,
    DeleteAccountCheckStatus? status,
  }) {
    return DeleteAccountCheckEntity()
      ..body = body ?? this.body
      ..status = status ?? this.status;
  }
}

DeleteAccountCheckBody $DeleteAccountCheckBodyFromJson(
    Map<String, dynamic> json) {
  final DeleteAccountCheckBody deleteAccountCheckBody = DeleteAccountCheckBody();
  final List<
      DeleteAccountCheckBodyChecklist>? checklist = (json['checklist'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<DeleteAccountCheckBodyChecklist>(
          e) as DeleteAccountCheckBodyChecklist).toList();
  if (checklist != null) {
    deleteAccountCheckBody.checklist = checklist;
  }
  final bool? pass = jsonConvert.convert<bool>(json['pass']);
  if (pass != null) {
    deleteAccountCheckBody.pass = pass;
  }
  final DeleteAccountCheckBodyPrimaryAccount? primaryAccount = jsonConvert
      .convert<DeleteAccountCheckBodyPrimaryAccount>(json['primaryAccount']);
  if (primaryAccount != null) {
    deleteAccountCheckBody.primaryAccount = primaryAccount;
  }
  return deleteAccountCheckBody;
}

Map<String, dynamic> $DeleteAccountCheckBodyToJson(
    DeleteAccountCheckBody entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['checklist'] = entity.checklist.map((v) => v.toJson()).toList();
  data['pass'] = entity.pass;
  data['primaryAccount'] = entity.primaryAccount.toJson();
  return data;
}

extension DeleteAccountCheckBodyExtension on DeleteAccountCheckBody {
  DeleteAccountCheckBody copyWith({
    List<DeleteAccountCheckBodyChecklist>? checklist,
    bool? pass,
    DeleteAccountCheckBodyPrimaryAccount? primaryAccount,
  }) {
    return DeleteAccountCheckBody()
      ..checklist = checklist ?? this.checklist
      ..pass = pass ?? this.pass
      ..primaryAccount = primaryAccount ?? this.primaryAccount;
  }
}

DeleteAccountCheckBodyChecklist $DeleteAccountCheckBodyChecklistFromJson(
    Map<String, dynamic> json) {
  final DeleteAccountCheckBodyChecklist deleteAccountCheckBodyChecklist = DeleteAccountCheckBodyChecklist();
  final String? item = jsonConvert.convert<String>(json['item']);
  if (item != null) {
    deleteAccountCheckBodyChecklist.item = item;
  }
  final bool? pass = jsonConvert.convert<bool>(json['pass']);
  if (pass != null) {
    deleteAccountCheckBodyChecklist.pass = pass;
  }
  return deleteAccountCheckBodyChecklist;
}

Map<String, dynamic> $DeleteAccountCheckBodyChecklistToJson(
    DeleteAccountCheckBodyChecklist entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['item'] = entity.item;
  data['pass'] = entity.pass;
  return data;
}

extension DeleteAccountCheckBodyChecklistExtension on DeleteAccountCheckBodyChecklist {
  DeleteAccountCheckBodyChecklist copyWith({
    String? item,
    bool? pass,
  }) {
    return DeleteAccountCheckBodyChecklist()
      ..item = item ?? this.item
      ..pass = pass ?? this.pass;
  }
}

DeleteAccountCheckBodyPrimaryAccount $DeleteAccountCheckBodyPrimaryAccountFromJson(
    Map<String, dynamic> json) {
  final DeleteAccountCheckBodyPrimaryAccount deleteAccountCheckBodyPrimaryAccount = DeleteAccountCheckBodyPrimaryAccount();
  final String? accountName = jsonConvert.convert<String>(json['accountName']);
  if (accountName != null) {
    deleteAccountCheckBodyPrimaryAccount.accountName = accountName;
  }
  final String? accountType = jsonConvert.convert<String>(json['accountType']);
  if (accountType != null) {
    deleteAccountCheckBodyPrimaryAccount.accountType = accountType;
  }
  return deleteAccountCheckBodyPrimaryAccount;
}

Map<String, dynamic> $DeleteAccountCheckBodyPrimaryAccountToJson(
    DeleteAccountCheckBodyPrimaryAccount entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['accountName'] = entity.accountName;
  data['accountType'] = entity.accountType;
  return data;
}

extension DeleteAccountCheckBodyPrimaryAccountExtension on DeleteAccountCheckBodyPrimaryAccount {
  DeleteAccountCheckBodyPrimaryAccount copyWith({
    String? accountName,
    String? accountType,
  }) {
    return DeleteAccountCheckBodyPrimaryAccount()
      ..accountName = accountName ?? this.accountName
      ..accountType = accountType ?? this.accountType;
  }
}

DeleteAccountCheckStatus $DeleteAccountCheckStatusFromJson(
    Map<String, dynamic> json) {
  final DeleteAccountCheckStatus deleteAccountCheckStatus = DeleteAccountCheckStatus();
  final String? domainCode = jsonConvert.convert<String>(json['domainCode']);
  if (domainCode != null) {
    deleteAccountCheckStatus.domainCode = domainCode;
  }
  final dynamic message = json['message'];
  if (message != null) {
    deleteAccountCheckStatus.message = message;
  }
  final dynamic path = json['path'];
  if (path != null) {
    deleteAccountCheckStatus.path = path;
  }
  final String? returnCode = jsonConvert.convert<String>(json['returnCode']);
  if (returnCode != null) {
    deleteAccountCheckStatus.returnCode = returnCode;
  }
  final bool? success = jsonConvert.convert<bool>(json['success']);
  if (success != null) {
    deleteAccountCheckStatus.success = success;
  }
  return deleteAccountCheckStatus;
}

Map<String, dynamic> $DeleteAccountCheckStatusToJson(
    DeleteAccountCheckStatus entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['domainCode'] = entity.domainCode;
  data['message'] = entity.message;
  data['path'] = entity.path;
  data['returnCode'] = entity.returnCode;
  data['success'] = entity.success;
  return data;
}

extension DeleteAccountCheckStatusExtension on DeleteAccountCheckStatus {
  DeleteAccountCheckStatus copyWith({
    String? domainCode,
    dynamic message,
    dynamic path,
    String? returnCode,
    bool? success,
  }) {
    return DeleteAccountCheckStatus()
      ..domainCode = domainCode ?? this.domainCode
      ..message = message ?? this.message
      ..path = path ?? this.path
      ..returnCode = returnCode ?? this.returnCode
      ..success = success ?? this.success;
  }
}